package org.chw.callback.scheduling;

import org.chw.callback.services.GetTokenService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @ClassName: GetTokenScheduling
 * @Description: 定时刷新微信token
 * @Autor: Vincent.Chen
 * @Create: 2018/6/13 13:42
 * @Version: 1.0
 **/
@Component
@Async
public class GetTokenScheduling {
  @Autowired
  private GetTokenService getTokenService;

  private static final Logger LOGGER = LoggerFactory.getLogger(GetTokenService.class);

  /**
   * @Author: Vincent.Chen
   * @Description: 启动时执行，之后每一个半时执行一次
   * @Date 2018/6/13 13:44
   * @Param []
   * @return void
   **/
  @Scheduled(initialDelay = 1000, fixedDelay = 1000 * 60 * 90)
  public void getToken() {
    this.getTokenService.getToken();
  }
}
